﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HA.Data
{
    [Serializable]
    public class SolidCollection
    {
        public SolidCollection()
        {
            this.Solid = new List<Solid>();
        }
        private List<Solid> _Solid;

        public List<Solid> Solid
        {
            get { return _Solid; }
            set { _Solid = value; }
        }

        [field: NonSerialized]
        public event EventHandler<CollecionChangedEventArgs> CollectionChanged;

        public void Add(Solid data)
        {
            this.Solid.Add(data);

            if (this.CollectionChanged != null)
            {
                this.CollectionChanged(this, new CollecionChangedEventArgs(data, CollectionChangedType.ADD));
            }
        }

        public void Remove(Solid data)
        {
            if (this.Solid.Contains(data))
            {
                this.Solid.Remove(data);

                if (this.CollectionChanged != null)
                {
                    this.CollectionChanged(this, new CollecionChangedEventArgs(data, CollectionChangedType.REMOVE));

                }

            }
        }
    }
}
